package config

import (
	"github.com/pelletier/go-toml"
)

// Config config
var Config *config

func init() {
	c, err := toml.LoadFile("config.toml")
	if err != nil {
		panic(err)
	}
	Config = &config{c}
}

type config struct {
	toml *toml.Tree
}

func (c *config) Get(key string, defaultValue interface{}) interface{} {

	value := c.toml.Get(key)
	if value == nil {
		return defaultValue
	}
	return value
}
